package com.gitee.deeround.jdbchelper.core.dialect.dameng;

import com.gitee.deeround.jdbchelper.out.DataType;
import com.gitee.deeround.jdbchelper.core.dialect.oracle.OracleDialect;

import java.util.HashMap;
import java.util.Map;


/**
 * 达梦数据库方言实现（达梦大多数语法兼容Oracle，只需要重写与Oracle不同的方法）
 *
 * @author deeround
 * @date 2024/03/29
 */
public class DamengDialect extends OracleDialect {

    @Override
    public String getPageSql(String sql, int pageNum, int pageSize) {
        return sql + " LIMIT " + ((pageNum - 1) * pageSize) + ", " + pageSize + " ";
    }

    @Override
    public Map<DataType, String> getDataType() {
        Map<DataType, String> types = new HashMap<>();
        types.put(DataType.String, "varchar");
        types.put(DataType.Date, "datetime");
        types.put(DataType.Clob, "text");
        types.put(DataType.Blob, "blob");
        types.put(DataType.Integer, "int");
        types.put(DataType.Decimal, "decimal");
        types.put(DataType.Object, "");
        types.put(DataType.Char, "char");
        return types;
    }

}
